package com.lsec.springbootinit.exception.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 通用状态枚举
 *
 * @author Cherry
 * @date 2023-03-03 14:42
 */

@Getter
@AllArgsConstructor
public enum TypicalCode {

    // ========== 客户端错误段 ==========
    SUCCESS_200(200,"操作成功"),

    BAD_REQUEST_400(400,"请求参数不正确"),
    UNAUTHORIZED_401(401,"账号未登录"),
    FORBIDDEN_403(403, "没有该操作权限"),
    NOT_FOUND_404(404, "请求未找到"),
    METHOD_NOT_ALLOWED_405(405, "请求方法不正确"),
    LOCKED_423(423, "请求失败，请稍后重试"),
    TOO_MANY_REQUESTS_429(429, "请求过于频繁，请稍后重试"),

    // ========== 服务端错误段 ==========
    INTERNAL_SERVER_ERROR_500(500, "系统异常"),
    NOT_IMPLEMENTED_501(501, "功能未实现/未开启"),


    // ========== 自定义错误段 ==========
    REPEATED_REQUESTS_900(900, "重复请求，请稍后重试"),
    DEMO_DENY_901(901, "演示模式，禁止写操作"),
    UNKNOWN_999(999, "未知错误"),


    REVERSE_CONVERT(3001,"不支持逆向转化方法!"),
    INVALID_TOKEN(2001,"访问令牌不合法"),
    ACCESS_DENIED(2003,"没有权限访问该资源"),
    CLIENT_AUTHENTICATION_FAILED(1001,"客户端认证失败"),
    USERNAME_OR_PASSWORD_ERROR(1002,"用户名或密码错误"),
    UNSUPPORTED_GRANT_TYPE(1003, "不支持的认证模式");


    /**
     * 自定义状态码
     */
    private final int code;

    /**
     * 自定义描述
     */
    private final String message;
}
